//
//  BCKnowledgeVC.m
//  BaoYouYou
//
//  Created by caobo56 on 2016/12/5.
//  Copyright © 2016年 caobo56. All rights reserved.
//

#import "BCKnowledgeVC.h"
#import "BCUserCenterCell.h"
#import "BCPregnancyInVC.h"
#import "BCPregnancyOnVC.h"
#import "BCPregnancyAfterVC.h"

@interface BCKnowledgeVC ()<UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation BCKnowledgeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"知识大全";
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView setLayoutMargins:UIEdgeInsetsZero];
    if([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }

    // Do any additional setup after loading the view from its nib.
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBarHidden = YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BCUserCenterCell * cell = [tableView dequeueReusableCellWithIdentifier:@"BCKnowledgeVCCell"];
    if (!cell) {
        cell = [BCUserCenterCell getBCUserCenterCell];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    [cell loaKnowledgeDataWith:indexPath.row];
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        BCPregnancyInVC * knowledge = [BCPregnancyInVC new];
        knowledge.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:knowledge animated:YES];
    }else if (indexPath.row == 1) {
        BCPregnancyOnVC * knowledge = [BCPregnancyOnVC new];
        knowledge.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:knowledge animated:YES];
    }else{
        BCPregnancyAfterVC * knowledge = [BCPregnancyAfterVC new];
        knowledge.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:knowledge animated:YES];
    }

}


@end
